// 腾讯云语音识别相关类型定义

// 签名获取请求
export interface VoiceSignatureRequest {
  userId: number;
}

// 新的签名获取响应格式 - 包含完整的WebSocket连接参数
export interface VoiceSignatureResponse {
  success: boolean;
  data: {
    appId: string;
    secretId: string;
    timestamp: number;
    expired: number;
    nonce: number;
    voiceId: string;
    signature: string;
    wsUrl: string;
    engine_model_type: string;
    voice_format: number;
    needvad: number;
    voice_id: string;
    queryParams: {
      engine_model_type: string;
      expired: number;
      needvad: number;
      nonce: number;
      secretid: string;
      timestamp: number;
      voice_format: number;
      voice_id: string;
      signature: string;
    };
  };
}

// 语音识别配置
export interface VoiceRecognitionConfig {
  secretId: string;
  secretKey: string;
  token?: string;
  appId: string;
  region?: string;
  engineType?: string; // 引擎类型，如 '16k_zh'
}

// 语音识别状态
export type VoiceRecognitionStatus = 'idle' | 'initializing' | 'listening' | 'processing' | 'error';

// 语音识别结果
export interface VoiceRecognitionResult {
  text: string;
  isFinal: boolean;
  confidence?: number;
}

// 语音识别事件
export interface VoiceRecognitionEvents {
  onResult: (result: VoiceRecognitionResult) => void;
  onError: (error: string) => void;
  onStatusChange: (status: VoiceRecognitionStatus) => void;
  onVolumeChange?: (volume: number) => void;
}

// 语音识别Hook返回值
export interface UseVoiceRecognitionReturn {
  status: VoiceRecognitionStatus;
  isListening: boolean;
  currentText: string;
  error: string | null;
  startListening: () => Promise<void>;
  stopListening: () => void;
  resetText: () => void;
} 